<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Manage Transporter</title>
</head>
<script type="text/javascript">

	//document.getElementById("hiddenButton").style.display="none";
	//document.getElementById("hiddebButtonYard").style.display="none";

	function yardSelected() {
		alert('inside yardSelected');
		document.getElementById("ManageTransporter").action = 'showTransporter';
		document.getElementById("ManageTransporter").submit();
	}
</script>
<body>
<sj:div id="ManageTransporterDiv">
	<s:form name="ManageTransporter" id="ManageTransporterForm"
		action="showTransporter" theme="simple">
		<table>
			<tr>
			<td width="10%">Select OEM :</td>
<td width="20%">
<s:select id = "oemType" name="oemType" list="oemList" listKey="oemId"
						listValue="oemName" headerKey="0" headerValue="Select OEM"
						onchange="$.publish('oemSelectedTopic')" >
						</s:select>
						<s:url var="populateYardUrl" action="populateTransporterYard" ></s:url>
		
			<sj:div id = "hiddebButtonYard" cssStyle="display:none;">
				<sj:submit  formIds="ManageTransporterForm"  href = "%{populateYardUrl}" listenTopics="oemSelectedTopic" targets="ManageTransporterDiv"></sj:submit>
			</sj:div>
</td>
				<td width="10%">
					Select Yard : 
				</td>
				<td width="20%">
				<s:select label="Select Yard" headerKey="-1"
					headerValue="Select Yard" list="listYard" listKey="id"
					listValue="name" name="selectedYardId" onchange="$.publish('showTransporterTopic')"/>
				</td>
				<td width="50%">
				</td>
				<td align="right">
				<sj:submit value="CreateTransporter"
						name="CreateTransporter"  cssClass="btnbg"  href="createTransporter.action"
						targets="ManageTransporterDiv" formIds="ManageTransporterForm"></sj:submit>
				</td>
			</tr>
		</table>
		<sj:div id = "hiddenButton" cssStyle="display:none;">
						<sj:submit href="showTransporter.action"
							targets="ManageTransporterDiv" formIds="ManageTransporterForm" listenTopics="showTransporterTopic"/>
		</sj:div>			
		<!-- <p><a href="<s:url action='createTransporter'/>">CreateTransporter</a></p> -->
		
<table width="99%" border="0" align="center" cellpadding="4" cellspacing="1" class="gridtable">
		<tr>
		<th colspan="4">All Available Transporter</th>
		</tr>
			<s:iterator value="listTransporter">
				<!--<a href="<s:url action='addTransporter'/>"><s:property
		value="name" /></a>
	-->
				<s:url action='showTransporterDetail' id="details">
					<s:param name="dto.id" value="%{id}" />
					<s:param name="selectedYardId" value="selectedYardId" />
				</s:url>
				<tr class="alt">
					<td><sj:a href="%{details}" targets="ManageTransporterDiv"
						formIds="ManageTransporterForm">
						<s:property value="name" />
					</sj:a> <br />
					</td>
				</tr>
			</s:iterator>
		</table>
	</s:form>
</sj:div>
</body>
</html>